<?php
namespace App\Utils\Logic\Ly;

use App\Models\Ly\wxLogin;
use App\Utils\Service\Ly\JwtServer;

class WxLoginLogic
{
    public static function wxLogin($userInfo)
    {
        $data=wxLogin::getOne($userInfo);
        if(!$data)
        {
            wxLogin::add($userInfo);
        }
        $Token=JwtServer::encode($data->id);
        wxLogin::edit(['session_key'=>$userInfo['session_key']]);
        return $Token;
    }
}
